import javax.print.DocFlavor;

public class Test {

    public static void main(String[] args){









/*
        String arr1 = "       abc def          ";

        System.out.println("[" + arr1 + "]");
        System.out.println("[" + arr1.trim() + "]");
*/

/*
        String arr1 = "abcdefg";

        System.out.println(arr1.substring(2));  //截取下标2到结尾范围的字符串
        System.out.println(arr1.substring(0,4));  //截取下标[0,4)范围的字符串
*/









/*
        String arr1 = "aaaa bbbb cccc";
        String[] arrrs1 = arr1.split(" ");
        for (int i = 0; i < arrrs1.length; i++) {
            System.out.println(arrrs1[i]);
        }

        System.out.println("=================");

        String[] arrrs2 = arr1.split(" ",2);
        for (int i = 0; i < arrrs2.length; i++) {
            System.out.println(arrrs2[i]);
        }
*/




/*
        String arr1 = "aaaabbbbcccc";

        System.out.println(arr1.replace('a','o')); //将所有的字符a替换为o
        System.out.println(arr1.replaceAll("aa","oo"));//将所有的字符串aa替换为oo
        System.out.println(arr1.replaceFirst("aa","oo"));//将第一个字符串aa替换为oo
*/

/*
        char[] ch = {'a','b','c','d'};
        String arr2 = new String(ch);
        System.out.println(ch);
*/



/*
        String arr1 = "abcd";
        char[] ch = arr1.toCharArray();
        for (int i = 0; i <ch.length ; i++) {
            System.out.println(ch[i]);
        }
*/



/*
        String arr1 = "aaa";
        String arr2 = "BBB";

        System.out.println(arr1.toUpperCase());//转大写
        System.out.println(arr2.toLowerCase());//转小写
*/
/*
        String arr1 = String.valueOf(123);
        String arr2 = String.valueOf(12.3);
        String arr3 = String.valueOf(true);

        System.out.println(arr1);
        System.out.println(arr2);
        System.out.println(arr3);

        int num1 = Integer.parseInt("123");
        double num2 = Double.parseDouble("123");

        System.out.println(num1);
        System.out.println(num2);
*/
       /* String arr1 = "abcda2bc1do1ab2oocdzbc2d";

        System.out.println(arr1.charAt(3)); //下标为3的元素 -》d
        System.out.println(arr1.indexOf('c')); //字符c，字符串中第一次出现的下标 -》2
        System.out.println(arr1.indexOf('c',8)); //字符c，字符串中从下标八开始第一次出现的下标 -》17
        System.out.println(arr1.indexOf("ab")); //字符串ab，字符串中第一次出现的下标 -》0
        System.out.println(arr1.indexOf("ab",3)); //字符ab，字符串中从下标三开始第一次出现的下标 -》12
        System.out.println(arr1.lastIndexOf('d')); //字符d，字符串中从最后开始倒着找第一次出现的下标 -》23
        System.out.println(arr1.lastIndexOf('d',6)); //字符d，字符串中从下标6开始倒着找第一次出现的下标 -》3
        System.out.println(arr1.lastIndexOf("cd")); //字符串cd，字符串中从最后开始倒着找第一次出现的下标 -》17
        System.out.println(arr1.lastIndexOf("cd",6)); //字符串cd，字符串中从下标6开始倒着找第一次出现的下标 -》2*/

/*
        String arr1 = new String("abcd");
        String arr2 = new String("ABcd");
        String arr3 = new String("oood");

        System.out.println(arr1.compareToIgnoreCase(arr2));
        System.out.println(arr1.compareToIgnoreCase(arr3));
        System.out.println(arr1.compareToIgnoreCase(arr3));
*/


/*
        String arr1 = new String("abcd");
        String arr2 = new String("abcd");
        String arr3 = new String("oooo");

        System.out.println(arr1.compareTo(arr2));
        System.out.println(arr1.compareTo(arr3));
        System.out.println(arr1.compareTo(arr3));
*/

//        String arr1 = new String("abcd");
//        String arr2 = new String("abcd");
//        String arr3 = new String("oooo");
//
//        System.out.println(arr1.equals(arr2));
//        System.out.println(arr1.equals(arr3));


/*
        String arr1 = new String("abcd");
        arr1 += "ooooo";
        System.out.println(arr1);
*/



/*
        String arr1 = new String("abcd");
        String arr2 = new String("abcd");


        String arr3 = "abcd";
        String arr4 = "abcd";

        System.out.println(arr1 == arr2);
        System.out.println(arr3 == arr4);
*/



/*
        String arr1 = "abcd";
        String arr2 = "abcd";
*/
/*
        String arr1 = "abcdefg";
        System.out.println("arr1 =" + arr1);

        String arr2 = new String("abcdefg");
        System.out.println("arr2 =" + arr2);

        char[] ch = {'a','b','c','d','e','f','g'};
        String arr3 = new String(ch);
        System.out.println("arr3 =" + arr3);
*/


    }

}
